home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8465 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  59 lines

  1. Path: news.mistral.co.uk!usenet
  2. From: mikebarnard@mistral.co.uk (Mike Barnard)
  3. Newsgroups: comp.lang.c
  4. Subject: Memory. How is it organised?
  5. Date: Mon, 04 Mar 1996 14:12:18 GMT
  6. Organization: Mistral Internet (Brighton)
  7. Message-ID: <4hf5gs$1f7@news.mistral.co.uk>
  8. NNTP-Posting-Host: l58.mistral.co.uk
  9. X-Newsreader: Forte Free Agent 1.0.82
  10.  
  11. Hi all.
  12.  
  13. I want to find out as much as possible about the stack and
  14. the heap. I know some of this is machine specific, but not
  15. all of it.
  16.  
  17. Suppose I did this?
  18.  
  19. struct tag
  20.     {
  21.     // Variables taking 100 bytes, for an example
  22.     };
  23.  
  24. struct tag arrayname[50];
  25.  
  26. What happens? Is 5000 bytes of memory reserved for the
  27. contents of the array? Where? Stack, heap or somewhere else?
  28. Or does the compiler just make a "note" that it will be
  29. needed then allocate some memory when the array(s) are
  30. initialised. Again, where? (What is the definition of stack
  31. or heap?)
  32.  
  33. Should I malloc the array? How? That is to say; malloc as a
  34. part of the array definition, or seperately looping through
  35. each member of the array and mallocing it after it's been
  36. defined?
  37.  
  38. Someone said on an irc channel about C++ that malloc is
  39. obsolete. "Use the new command" he said. Then logged off!!!
  40. I presume there's something in C++ that relates to this, but
  41. I don't feel ready for OO yet. I want to learn to walk, not
  42. run.
  43.  
  44. I've looked for an FAQ covering this type of info, but not
  45. found one. Anyone got an ftp/http for one?
  46.  
  47. I'm using a 486 PC and Borland C++ 3.0 but in C mode only.
  48. I'm not looking for segment:address information on PC's,
  49. unless it's relevant to stacks and the heap.
  50.  
  51. So many questions, so few hours in a day. Thanks for your
  52. patience. Again.
  53.  
  54. ---
  55. Mic.
  56. From windy and damp Worthing; England.
  57. mikebarnard@mistral.co.uk
  58.  
  59.